//
//  HYFTitleButton.m
//  MyOCWeibo
//
//  Created by 黄勇锋 on 16/10/3.
//  Copyright © 2016年 黄勇锋. All rights reserved.
///Users/huangyongfeng/Desktop/OCWeibo/MyOCWeibo/MyOCWeibo/Classes/Public/Category/HYFTitleButton.m:26:40: Invalid operands to binary expression ('MASViewAttribute * _Nullable' and 'MASViewAttribute * _Nullable')

#import "HYFTitleButton.h"


#define MARGIN 5


@implementation HYFTitleButton

- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    //先调整titleLabel的x为0
    
    self.titleLabel.x = 0;
    self.imageView.x = CGRectGetMaxX(self.titleLabel.frame) + MARGIN;
    
    self.width = self.titleLabel.width + self.imageView.width + MARGIN;
    self.centerX = self.superview.width * 0.5;
    
//    [self makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.centerX.equalTo(self.superview);
//        make.width.equalTo(self.titleLabel.frame.size.width +         self.imageView.frame.size.width + MARGIN);
//    }];

    
}



- (void)setTitle:(NSString *)title forState:(UIControlState)state{
    [super setTitle:title forState:state];
    [self sizeToFit];
}

- (void)setImage:(UIImage *)image forState:(UIControlState)state{
    [super setImage:image forState:state];
    [self sizeToFit];
}




@end
